package com.library.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.library.bean.User;
import com.library.dao.UserDao;
import com.library.dao.impl.UserDaoImpl;
import com.library.service.UserService;

public class UserServiceImpl implements UserService {
	
	private UserDao userDao = new UserDaoImpl() ;
	
	@Override
	public Map<String, Object> userLogin(String username,String password) {
		Map<String,Object> map = new HashMap();
		User user = userDao.selectUser(username, password);
		if(user != null) {
			map.put("loginUser", user);
		}else {
			user = userDao.selectUser(username);
			if(user != null) {
				map.put("msg","密码错误");
			}else {
				map.put("msg","用户名不存在");
			}
		}
		return map;
	}
	
	
}
